package com.clothing.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @ClassName: Friend
 * @Description: TODO(Entity-Friend)
 * @author Charles.Tao
 * @date 2017年9月4日 下午2:20:19
 * @version 1.0
 */
@Entity
@Table(name = "friend")
public class Friend extends BaseEntity
{
    /**
     * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
     */
    
    public enum Status
    {
        /** 小的关注大的  */
        small_to_big,
        
        /** 大的关注小的  */
        big_to_small,
        
        /** 双向关注  */
        mutual
    }
    
    public enum FriendStatus
    {
      /** 关注 */
      attention,
   
      /** 粉丝 */
      fans,
      
      /** 好友  */
      friend,
      
      /** 陌生人 */
      stranger
    }
    
    private static final long serialVersionUID = 4263489755662782687L;

    private User smallUser;
    
    private User bigUser;
    
    private Status status;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "small_user", nullable = false)
    public User getSmallUser()
    {
        return smallUser;
    }

    public void setSmallUser(User smallUser)
    {
        this.smallUser = smallUser;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "big_user", nullable = false)
    public User getBigUser()
    {
        return bigUser;
    }

    public void setBigUser(User bigUser)
    {
        this.bigUser = bigUser;
    }

    @Column(name = "status", nullable = false)
    public Status getStatus()
    {
        return status;
    }

    public void setStatus(Status status)
    {
        this.status = status;
    }
    
    @Transient
    public boolean isBig(User user)
    {
        return user.getId().equals(bigUser.getId());
    }
}
